Skip to content

Fix hints and improve unit tests#283

Merged
jaredjj3 merged 13 commits intomasterfrom
hints
May 1, 2025
Merged

Fix hints and improve unit tests#283
jaredjj3 merged 13 commits intomasterfrom
hints

Conversation

@jaredjj3
Copy link
Collaborator

@jaredjj3 jaredjj3 commented May 1, 2025

This PR fixes #281. It will be released in 0.1.8.

  • This PR formalizes the describer pattern and uses it in existing Timeline and CursorFrame tests.
  • Marks MeasureSequenceIterator as LegacyMeasureSequenceIterator to communicate intent of eventually replacing it.

@jaredjj3 jaredjj3 self-assigned this May 1, 2025
@jaredjj3 jaredjj3 marked this pull request as ready for review May 1, 2025 12:14
@jaredjj3 jaredjj3 requested a review from Copilot May 1, 2025 12:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #281 by updating the hint generation logic and improving unit tests through new describer patterns. Key changes include:

  • Updating expected human-readable hint outputs in unit tests.
  • Propagating the new ElementDescriber and HintDescriber through playback components.
  • Renaming MeasureSequenceIterator to LegacyMeasureSequenceIterator and updating its usage.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/playback/timeline.test.ts Updated expected hint output strings to include ElementDescriber formatting changes
tests/unit/playback/measuresequenceiterator.test.ts Renamed MeasureSequenceIterator to LegacyMeasureSequenceIterator and updated its usage
tests/unit/playback/lazycursorstatehintprovider.test.ts Updated tests for hints to use new hint describer and human-readable outputs
tests/unit/playback/defaultcursorframe.test.ts Passed ElementDescriber instances to DefaultCursorFrame.create
src/playback/types.ts Added toHumanReadable method on CursorStateHintProvider
src/playback/timeline.ts Integrated ElementDescriber into TimelineFactory and TimelineDescriber
src/playback/legacymeasuresequenceiterator.ts Renamed the iterator class from MeasureSequenceIterator to LegacyMeasureSequenceIterator
src/playback/lazycursorstatehintprovider.ts Added toHumanReadable implementation and updated note comparison conditions
src/playback/hintdescriber.ts Introduced new HintDescriber class
src/playback/elementdescriber.ts Added ElementDescriber to produce consistent human-readable descriptions
src/playback/defaultcursorframe.ts Updated factory and describer usage to include ElementDescriber
src/playback/cursor.ts Updated Cursor creation and iteration to pass ElementDescriber
src/elements/score.ts Integrated ElementDescriber in creating frames and cursors
Comments suppressed due to low confidence (2)

src/playback/legacymeasuresequenceiterator.ts:13

  • [nitpick] Renaming MeasureSequenceIterator to LegacyMeasureSequenceIterator clarifies legacy behavior; consider adding documentation to detail the differences from the current implementation.
export class LegacyMeasureSequenceIterator<T extends Measure> implements Iterable<number> {

src/playback/lazycursorstatehintprovider.ts:78

  • Adding the check for previousNote !== currentNote improves safety by avoiding self-comparisons; please ensure that this change is in line with the intended behavior in hint generation.
if (previousNote && previousNote !== currentNote && !previousNote.sharesACurveWith(currentNote)) {

@jaredjj3
Copy link
Collaborator Author

jaredjj3 commented May 1, 2025

@rvilarl, I'm going to release a vexml patch with this PR so that you're unblocked. There may be still issues with repeats and chords.

@jaredjj3 jaredjj3 merged commit 45db9bb into master May 1, 2025
1 check passed
@jaredjj3 jaredjj3 deleted the hints branch May 1, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve LazyCursorStateHintProvider unit tests

2 participants